#include "Poco/Logger.h"
#include "Poco/FileChannel.h"
#include "Poco/ConsoleChannel.h"
using Poco::Logger;
using Poco::FileChannel;
using Poco::ConsoleChannel;

int main(int argc, char *argv[])
{
	string msg("warning");
	string out = Poco::format("A warning message:%s",msg.c_str());
	// set up two channel chains - one to the
	// console and the other one to a log file.
	ConsoleChannel* pFCConsole = new ConsoleChannel();
	pFCConsole->open();
	
	FileChannel* pFC = new FileChannel("./test.log","%Y-%m-%d %H:%M:%S.%i %N[%P],[%p]:");
	pFC->open();

	// create two Logger objects - one for
	// each channel chain.
	Logger& consoleLogger = Logger::create("ConsoleLogger", pFCConsole, Poco::LOG_DEBUG);
	Logger& fileLogger    = Logger::create("FileLogger", pFC, Poco::LOG_DEBUG);
	
	// log some messages
	//consoleLogger.error("An error message");
	fileLogger.error("An error message");
	consoleLogger.error("An error message");
	
	//consoleLogger.warning("A warning message");
	fileLogger.warning("A warning message");
	consoleLogger.warning(out);
	//consoleLogger.information("An information message");
	fileLogger.information("An information message");
	consoleLogger.information("An information message");
	
	//poco_information(consoleLogger, "Another informational message");
	//poco_warning_f2(consoleLogger, "A warning message with arguments: %d, %d", 1, 2);
	
	//Logger::get("ConsoleLogger").error("Another error message");
	
	return 0;
}
